package Global;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

import Global.*;

public class TransObject implements Serializable
{
	public int		type;
	public int		siteType;
	public Object	obj;
	public byte		buffer[];
	public int		dataBytes;

	private void writeObject(java.io.ObjectOutputStream out) throws IOException
	{
		out.defaultWriteObject();
		out.writeInt(type);
		out.writeInt(siteType);
		out.writeObject(obj);
		if (dataBytes != 0)
		{
			out.write(buffer, 0, dataBytes);
		}
	}

	private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException
	{
		in.defaultReadObject();
		type = in.readInt();
		siteType = in.readInt();
		obj = in.readObject();
		dataBytes = in.read(buffer);
	}

	public TransObject(int t, int site,Object o)
	{
		type = t;
		siteType = site;
		obj = o;
		buffer = new byte[1024 * 4];
		dataBytes = 0;
	}

}
